﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/Admin.Master" AutoEventWireup="true"
    CodeBehind="QL_SlideShow.aspx.cs" Inherits="ChineseSchool.Admin.QL_SlideShow" %>

<%@ Register Src="ImageUpload.ascx" TagName="ImageUpload" TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <style type="text/css">
        .form-horizontal .control-label {
            text-align: left;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder_Top" runat="server">
    <div class="text-danger">
        <asp:Label ID="lblThongbao" runat="server"></asp:Label>
    </div>
    <asp:Panel ID="panUpdate" runat="server" Visible="false">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-info">
                    <div class="box-header with-border">
                        <asp:Label ID="lblTitle" runat="server"></asp:Label>
                    </div>
                    <div class="form-horizontal">
                        <div class="box-body">
                            <div class="form-group">
                                <asp:Label ID="lblUIPage" Text="Trang giao diện:" CssClass="col-sm-2 control-label" runat="server" AssociatedControlID="ddlPage" />
                                <div class="col-sm-10">
                                    <asp:DropDownList ID="ddlPage" runat="server" CssClass="form-control">
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblUploadImage" Text="Tải ảnh:" CssClass="col-sm-2 control-label" runat="server" AssociatedControlID="fuImageUrl" />
                                <div class="col-sm-10">
                                    <asp:FileUpload ID="fuImageUrl" runat="server" />
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblImageName" Text="Tên ảnh:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <asp:TextBox runat="server" ID="txtImageName" Text='<%# Bind("ImageName") %>' MaxLength="250"
                                        CssClass="form-control"></asp:TextBox>
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblLink" Text="Link liên kết:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <asp:TextBox runat="server" ID="txtLink" Text='<%# Bind("Link") %>' MaxLength="250"
                                        CssClass="form-control"></asp:TextBox>
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblContent" Text="Nội dung:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <asp:TextBox runat="server" ID="txtDescription" Text='<%# Bind("Description") %>'
                                        CssClass="form-control" TextMode="MultiLine" Rows="3"></asp:TextBox>
                                </div>
                            </div>
                            <div class="form-group">
                                <asp:Label ID="lblIsLock" Text="Hiển thị:" CssClass="col-sm-2 control-label" runat="server" />
                                <div class="col-sm-10">
                                    <div class="radio col-sm-2">
                                        <asp:RadioButton ID="rbYes" runat="server" Text="Có" GroupName="rbLock" />
                                    </div>
                                    <div class="radio col-sm-2">
                                        <asp:RadioButton ID="rbNo" runat="server" Text="Không" GroupName="rbLock" />
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                        <div class="box-footer">
                            <asp:Button ID="btnEdit" runat="server" Text="Cập nhật" OnClientClick=" return confirm('Bạn có muốn sửa thông tin?') "
                                OnClick="btnEdit_Click" />
                            <asp:Button ID="btnCancel" runat="server" Text="Hủy" OnClick="btnCancel_Click" />
                        </div>
                        <!-- /.box-footer -->
                    </div>
                </div>
            </div>
        </div>
    </asp:Panel>
    <asp:Panel ID="PanAdd" runat="server" Visible="false">
        <div class="row">
            <div class="col-md-12">
                <div class="box box-info">
                    <div class="box-header with-border">
                        <asp:Label ID="Label1" runat="server"></asp:Label>
                    </div>
                    <div class="form-horizontal">
                        <div class="box-body">
                            <div class="form-group">
                                <asp:Label ID="lblUIPageAdd" Text="Trang giao diện:" CssClass="col-sm-2 control-label" runat="server" AssociatedControlID="ddlPage" />
                                <div class="col-sm-10">
                                    <asp:DropDownList ID="ddlPageAdd" runat="server" CssClass="form-control">
                                    </asp:DropDownList>
                                </div>
                            </div>
                            <uc1:ImageUpload ID="ImageUpload1" runat="server" />
                        </div>
                        <div class="box-footer">
                            <asp:Button ID="btnAdd" runat="server" Text="Thêm mới" CssClass="btnSubmit" OnClick="btnAdd_Click" />
                            <asp:Button ID="Button1" runat="server" Text="Cập nhật" CssClass="btnSubmit"
                                OnClick="btnEdit_Click" />
                            <asp:Button ID="Button2" runat="server" Text="Hủy" OnClick="btnCancel_Click" />
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </asp:Panel>
    <div class="row">
        <div class="col-xs-12">
            <div class="box">
                <div class="box-header with-border">
                    <h3 class="box-title">Danh sách image/Danh mục:</h3>
                </div>
                <!-- /.box-header -->
                <div class="box-body">
                    <asp:GridView ID="grdImage" runat="server" AutoGenerateColumns="False"
                        AllowPaging="True" EnableModelValidation="True" CssClass="table table-bordered"
                        AllowSorting="True"
                        OnRowCommand="grdImage_RowCommand" OnRowDeleting="grdImage_RowDeleting"
                        OnRowEditing="grdImage_RowEditing" OnPageIndexChanging="grdImage_PageIndexChanging"
                        PageSize="10">
                        <PagerStyle CssClass="gvpagercss" BackColor="#F6F6F6" ForeColor="Black" HorizontalAlign="Center"
                            VerticalAlign="Middle" />
                        <Columns>
                            <asp:TemplateField HeaderText="Stt" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <%# Container.DataItemIndex + 1 %>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="ImageID" Visible="false" />
                            <asp:TemplateField ItemStyle-Width="80px" HeaderText="Ảnh" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <img src='<%# Eval("ImageUrl") %>' width="80px" alt=""></img>
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:BoundField DataField="ImageName" HeaderText="Tên ảnh" ReadOnly="true" />
                            <asp:BoundField DataField="PageName" HeaderText="Trang giao diện" ReadOnly="true" />
                            <asp:BoundField DataField="Link" HeaderText="Link liên kết" ReadOnly="true" />
                            <asp:TemplateField ItemStyle-Width="30px" HeaderText="Sửa" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:ImageButton ID="imgedit" runat="server" ImageUrl="Images/edit.png" ToolTip="Sửa thông tin"
                                        CommandArgument='<%# Eval("ImageID") %>' CommandName="Edit" />
                                </ItemTemplate>
                            </asp:TemplateField>
                            <asp:TemplateField ItemStyle-Width="30px" HeaderText="Xóa" ItemStyle-HorizontalAlign="Center">
                                <ItemTemplate>
                                    <asp:ImageButton ID="imgDel" runat="server" ImageUrl="Images/del.gif" ToolTip="Xóa danh mục"
                                        CommandArgument='<%# Eval("ImageID") %>' CommandName="Delete" OnClientClick=" return confirm('Bạn có chắc chắn muốn xoá?') " />
                                </ItemTemplate>
                            </asp:TemplateField>
                        </Columns>
                    </asp:GridView>
                    <div align="left" style="font-weight: bold">
                        <asp:Label ID="lbl_count" runat="server" Visible="false"></asp:Label>
                    </div>
                </div>

                <div class="box-footer clearfix">
                    <div class="col-xs-6 text-left">
                        <i>Bạn đang xem trang
                            <%=grdImage.PageCount==0 &&  grdImage.PageIndex == 0 ? 0 : grdImage.PageIndex+1%>
                            của
                            <%=grdImage.PageCount%></i>
                    </div>
                    <div class="col-xs-6 text-right">
                        <asp:Button ID="btnNew" runat="server" Text="Thêm mới" OnClick="btnNew_Click" />
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
